﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sherwood.SignOn.Server.Models.Repositories
{
    /// <summary>
    /// Interface for repository of trusted / known client applications.
    /// </summary>
    public interface IClientRepository
    {
        /// <summary>
        /// Verifies that messageSignature is a signature for messageText created by the client with the 
        /// specified clientCode.
        /// </summary>
        /// <param name="clientCode">ClientCode (identifier) of client application</param>
        /// <param name="messageText">Plain message text</param>
        /// <param name="messageSignature">Signature of message text</param>
        /// <returns>True if message could be verified, other False</returns>
        bool VerifyMessage(string clientCode, string messageText, string messageSignature);

        /// <summary>
        /// Retrieves the RSA public key for the specified client
        /// </summary>
        /// <param name="clientCode">ClientCode (identifier) of client application to retreive key for.</param>
        /// <returns>Key in PEM format if found, otherwise null</returns>
        string GetRsaPublicKey(string clientCode);
    }

}
